#ifndef _DSWMESSAGESESSION_H
#define _DSWMESSAGESESSION_H

#include "tcpcombase.h"

class CDswmessagesession : public CTcpcombase
{
public:
	CDswmessagesession();
	virtual ~CDswmessagesession();
public:
	CDswmessagesession(LPST_ENV_T pEnv, struct bufferevent * pBev, int nHeadSize);
	CDswmessagesession(LPST_ENV_T pEnv, struct bufferevent * pBev, int nHeadSize, char* pHost, int nPort);
private:
	virtual void SendMsg(char* pMsg){};
	virtual bool ProcessMessage(char* pMsg, int nLen, struct evbuffer *outbuf);
	virtual void MakeRespXML(const char* pMsgType, CMarkup & xml, int nerrcode){};
	void GetNetWifiParam(CMarkup& xml);
	void GetNetEthParam(CMarkup& xml);
	void GetNetPppoeParam(CMarkup& xml);
	void GetAudioParam(CMarkup& xml);
	void GetVideoParam(CMarkup& xml, int ch_num);
	void GetSystemParam(CMarkup& xml);
	void GetAlarmParam(CMarkup& xml);
	void GetAreCfgParam(CMarkup& xml);
	void GetLocateParam(CMarkup& xml);
	void GetVideoSetParam(CMarkup& xml, int ch_num);

	void SetNetParam(void* pMsg);
	void SetWifiParam(void* pMsg);
	void SetEthParam(void* pMsg);
	void SetPppoeParam(void* pMsg);
	void SetMediaParam(void* pMsg);
	void SetVideoParam(void* pMsg);
	void SetAudioParam(void* pMsg);
	void SetSystemParam(void* pMsg);
	void SetAlarmParam(void* pMsg);
	void SetAreCfgParam(void* pMsg);
	void SetOtherParam(void* pMsg);
	void SetLocateParam(void* pMsg);
	void SetVideoSetParam(void* pMsg);
	void SetPTZParam(void* pMsg);
	void SetPoliceParam(void* pMsg);

	int GetDirFile(string & sDirList, char *pDir, int nIndex, int nPageSize, int &nRestCount, bool &bIsDir);

	virtual void CheckPUCID(CMarkup* pXml){};
public:
//LAN
	static bool cbGetParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->GetParamReq(pMsgReq, pMsgResp);};
	static bool cbSetParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->DealSetParamReq(pMsgReq, pMsgResp);};

	static bool cbGetFactoryParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->GetFactoryParamReq(pMsgReq, pMsgResp);};
	static bool cbSetFactoryParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->SetFactoryParamReq(pMsgReq, pMsgResp);};

	static bool cbGetSdDirListReq(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->GetSdDirListReq(pMsgReq, pMsgResp);};

	static bool cbGetSdRecFnDownReq(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->GetSdRecFnDownReq(pMsgReq, pMsgResp);};

	static bool cbGetSdRecFnPlayReq(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->GetSdRecFnPlayReq(pMsgReq, pMsgResp);};
	static bool cbProcessStopRecVideoReq(void * pRetMsg, const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->ProcessStopRecVideoReq(pRetMsg, pMsgResp);};
	static bool cbProcessSetRecVideoSpdReq(void * pRetMsg, const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->ProcessSetRecVideoSpdReq(pRetMsg, pMsgResp);};
	static bool cbProcessSetRecVideoPosReq(void * pRetMsg, const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->ProcessSetRecVideoPosReq(pRetMsg, pMsgResp);};

//WAN
	static bool cbDealRegisterToP2PServer(void* pMsgReq,const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->DealRegisterToP2PServer(pMsgReq, pMsgResp);};
	static bool cbDealHeartResp(void* pMsgReq, const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->DealHeartResp(pMsgReq, pMsgResp);};
	static bool cbDealP2PResp(void* pMsgReq, const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->DealP2PResp(pMsgReq, pMsgResp);};
	static bool cbDealGetPuaReq(void * pMsgReq,const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->DealGetPuaReq(pMsgReq, pMsgResp);};
	static bool cbDealGetVPortReq(void * pMsgReq,const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->DealGetVPortReq(pMsgReq, pMsgResp);};
	static bool cbDealGetVideoReq(void * pMsgReq,const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->DealGetVideoReq(pMsgReq, pMsgResp);};
	static bool cbDealStopVideoReq(void * pMsgReq,const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->DealStopVideoReq(pMsgReq, pMsgResp);};
	static bool cbDealStartTransVideo(void* pMsgReq, const char* pMsgResp, void* pCaller){return ((CDswmessagesession*)pCaller)->DealStartTransVideo((char*)pMsgReq, pMsgResp);};
	static bool cbDealStopTransVideo(void * pMsgReq, const char* pMsgResp, void * pCaller){return ((CDswmessagesession*)pCaller)->DealStopTransVideo((char*)pMsgReq, pMsgResp);};
private:
	bool GetParamReq(void* pMsgReq, const char* pMsgResp);
	bool DealSetParamReq(void * pMsgReq, const char* pMsgResp);

	bool GetFactoryParamReq(void* pMsgReq,const char* pMsgResp);
	bool SetFactoryParamReq(void* pMsgReq, const char* pMsgResp);

	bool GetSdDirListReq(void* pMsgReq, const char* pMsgResp);

	bool GetSdRecFnDownReq(void* pMsgReq, const char* pMsgResp);

	bool GetSdRecFnPlayReq(void* pMsgReq, const char* pMsgResp);
	bool ProcessStopRecVideoReq(void * pMsgReq, const char* pMsgResp);
	bool ProcessSetRecVideoSpdReq(void * pMsgReq, const char* pMsgResp);
	bool ProcessSetRecVideoPosReq(void * pMsgReq, const char* pMsgResp);

	virtual bool DealRegisterToP2PServer(void * pMsgReq, const char* pMsgResp){return true;};
	virtual bool DealHeartResp(void * pMsgReq, const char* pMsgResp){return true;};
	bool DealP2PResp(void * pMsgReq, const char* pMsgResp);
	virtual bool DealGetPuaReq(void * pMsgReq, const char* pMsgResp){return true;};
	virtual bool DealGetVPortReq(void * pMsgReq, const char* pMsgResp){return true;};
	virtual bool DealGetVideoReq(void * pMsgReq, const char* pMsgResp){return true;};
	virtual bool DealStopVideoReq(void * pMsgReq, const char* pMsgResp){return true;};

	virtual bool DealStartTransVideo(void * pMsgReq, const char* pMsgResp){return true;};
	virtual bool DealStopTransVideo(void * pMsgReq, const char* pMsgResp){return true;};
protected:
	char m_sKey[64];
};

#endif

